<?php

namespace app\index\controller;

use app\common\controller\Frontend;

class Download extends Frontend
{

    protected $noNeedLogin = '*';
    protected $noNeedRight = '*';
    protected $layout = '';

    public function ablum()
    {
        $id = $this->request->get('id');
        $picArr = \think\Db::name('WorksPhoto')->where('works_catalog_id',$id)->order('weigh esc')->select();
        if(empty($picArr)){
            $this->error('无图片文件');
        }
        foreach ($picArr as $key => &$value) {
            //判断图片是否存在
            $value['url'] = cdnurl($value['image']);
            $value['name'] = $value['weigh'].'-'.basename($value['image']);
        }
        $this->assign('pic',json_encode($picArr));
        return $this->view->fetch();
    }

}